package org.example.object.notify;

public class Demo {
    public static void main(String[] args) {
        Object lock = new Object();
        Object[] buffer = new Object[1];
        Producer producer = new Producer(lock, buffer);
        Consumer consumer = new Consumer(lock, buffer);

        new Thread(() -> {
            while (true) {
                producer.produce();
            }
        }).start();

        new Thread(() -> {
            while (true) {
                consumer.consume();
            }
        }).start();
    }
}
